<template>
	<view class="Desigener">
		<view class="AddAddress_item">
			<!-- 姓名 -->
			<view class="AddAddress_item_demo">
				<view class="title">真实姓名</view>
				<view class="name">
					<input type="text" placeholder="请输入真实姓名" placeholder-style="color:#7d7d7d" v-model="dcname.DCname" confirm-type="done" />
				</view>
			</view>
			<!-- 手机号 -->
			<view class="AddAddress_item_demo">
				<view class="title">手机号码</view>
				<view class="name">
					<input type="number" placeholder="请输入手机号" placeholder-style="color:#7d7d7d" v-model="dcname.DCnum"
						confirm-type="done" />
				</view>
			</view>					
		</view>
		<view class="AddAddress_btn" @click="getSumbit">提交</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
				dcname:{
					// 设计师名字
					DCname:'',
					// 设计师手机号
					DCnum:'',
					// id:''
				}
			};
		},
		methods:{
			getSumbit(){
				var u_phone = /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/;
				var DCname=this.dcname.dcname;
				var DCnum=this.dcname.DCnum;
				
				if(DCname==""){
					uni.showToast({
						title: "请输入姓名",
						icon: "none",
						duration: 2000
					})
				}else if(DCnum==""){
					uni.showToast({
						title: "请输入手机号",
						icon: "none",
						duration: 2000
					})
				}else if(DCnum.length!=11){
					uni.showToast({
						title: "请输入11位有效的手机号码",
						icon: "none",
						duration: 2000
					})
				}else if(!u_phone.test(DCnum)){
					uni.showToast({
						title: "手机号有误请重新输入",
						icon: "none",
						duration: 2000
					})
				}else{
					this.$api.get({
						url: '/wanlshop/user/postDCdata',
						data:this.dcname,
						
						success: res => {
							// console.log('res',res)
							uni.reLaunch({
								url:'../mine/mine'
							})
						}
					});
					// console.log('dcname',this.dcname);
					
					
				}
				console.log('DCname',this.dcname )
								
			}
		},
		onLoad() {
			this.dcname.id=uni.getStorageSync("wanlshop:user").id
			
			// console.log('id',id)
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f0f0f0;
	}
	.Desigener{
		
	
	.AddAddress_item {
			background-color: #FFFFFF;
			// height: 500rpx;

			&_demo {
				display: flex;
				align-items: center;
				// background-color: pink;
				height: 100rpx;
				border-bottom: 1px solid #f0f0f0;

				.title {
					font-size: 30rpx;
					color: #000000;
					// background-color: red;
					width: 200rpx;
					margin-left: 30rpx;
					height: 80rpx;
					line-height: 80rpx;
				}

				.name {
					
					width: 500rpx;
					font-size: 30rpx;
					color: #7d7d7d;

					.gb-picker {
						background-color: pink;
						height: 50rpx;
					}

					input {
						// background-color: #4CD964;
						height: 80rpx;
						line-height: 80rpx;
						font-size: 30rpx;
						color: #282828;
					}
				}

			}

			
		}
		.AddAddress_btn{
			background-color:#ff3200 ;
			font-size: 30rpx;
			color: #FFFFFF;
			border-radius: 50rpx;
			height: 90rpx;
			line-height: 90rpx;
			width: 700rpx;
			text-align: center;
			margin: 40rpx auto;
			
		}
		}
</style>
